<ui:composition xmlns="http://www.w3.org/1999/xhtml"
                xmlns:ui="http://java.sun.com/jsf/facelets"
                xmlns:h="http://java.sun.com/jsf/html"
                xmlns:p="http://primefaces.org/ui" xmlns:f="http://java.sun.com/jsf/core"
                xmlns:constants="http://www.tuanzi.com/constants/tags"
                xmlns:security="http://www.springframework.org/security/tags"
                template="/templates/template.xhtml">
    <ui:define name="title">代偿取现子订单列表</ui:define>
    <ui:define name="content">


        <h:form>
            <p:dialog header="操作执行中,请稍候" widgetVar="doing" modal="true" closable="false" resizable="false"
                      draggable="false"/>
            <p:defaultCommand target="search"/>
            <div class="topbar clearfix" style="background: -webkit-linear-gradient(top,#f6f7f9 0,#ebedf0 100%);">
                <p:toolbar>
                    <f:facet name="left">
                        <p:commandButton id="toggler" type="button" value="展示选择"
                                         style="width: auto;"
                                         icon="ui-icon-calculator"/>
                        <p:columnToggler datasource="statisticRecordDataTable" trigger="toggler"/>
                    </f:facet>
                    <f:facet name="right">
                        <p:commandButton id="search" value="查询" icon="fa fa-search"
                                         onstart="PF('doing').show()"
                                         update="@form"/>
                        <p:commandButton value="重置" actionListener="#{compensationChildOrderListBean.onReset()}" icon="fa fa-refresh"
                                         process="@this" update="@form"/>
                        <p:commandButton value="导出" icon="fa fa-download"
                                         ajax="false">
                            <p:dataExporter type="xls" target="statisticRecordDataTable" fileName="维厘子订单"/>
                        </p:commandButton>
                    </f:facet>
                </p:toolbar>
            </div>
            <div class="ui-g ui-fluid" style="padding-top: 30px;">
                <div class="ui-g-12">
                    <div class="ui-g-12 card">
                        <h1>查询条件</h1>
                        <div class="ui-g-1">
                            <p:outputLabel value="手机号"/>
                        </div>
                        <div class="ui-g-3">
                            <p:inputText id="phone" value="#{compensationChildOrderListBean.$.phone}"/>
                        </div>

                        <div class="ui-g-1">
                            <p:outputLabel value="姓名"/>
                        </div>
                        <div class="ui-g-3">
                            <p:inputText id="petname" value="#{compensationChildOrderListBean.$.petname}"/>
                        </div>

                        <div class="ui-g-1">
                            <p:outputLabel value="主订单号"/>
                        </div>
                        <div class="ui-g-3">
                           <p:inputText id="parentOrderId" value="#{compensationChildOrderListBean.$.parentOrderId}"/>
                        </div>
                        <div class="ui-g-1">
                            <p:outputLabel value="时间"/>
                        </div>
                        <div class="ui-g-3">
                            <p:calendar
                                    id="startTime" styleClass="autoWidthCalendar"
                                    value="#{compensationChildOrderListBean.$.startTime}"
                                    locale="#{constants:get('LOCALE')}"
                                    timeZone="#{constants:get('TIME_ZONE')}"
                                    pattern="#{constants:get('DATE_FORMAT')}"/>
                            <span>—</span>
                            <p:calendar
                                    id="endTime" styleClass="autoWidthCalendar"
                                    value="#{compensationChildOrderListBean.$.endTime}"
                                    locale="#{constants:get('LOCALE')}"
                                    timeZone="#{constants:get('TIME_ZONE')}"
                                    pattern="#{constants:get('DATE_FORMAT')}"/>
                        </div>
                    </div>


                    <div class="ui-g-12 card">
                        <p:dataTable id="statisticRecordDataTable"
                                     style="width: 100%;text-align:center"
                                     var="record"
                                     value="#{compensationChildOrderListBean.lazyDataModel}"
                                     rows="#{constants:get('ROWS')}"
                                     lazy="true"
                                     paginator="true"
                                     paginatorTemplate="#{constants:get('PAGINATOR_TEMPLATE')}"
                                     rowsPerPageTemplate="#{constants:get('ROWS_PER_PAGE_TEMPLATE')}"
                                     emptyMessage="#{constants:get('EMPTY_MESSAGE')}"
                                     scrollable="true"
                                     scrollWidth="97%"
                                     reflow="true"
                                     selection=""
                                     resizableColumns="true">
                            <p:column headerText="时间" style="text-align:center;">
                                <h:outputText value="#{record.createTime}">
                                    <f:convertDateTime pattern="#{constants:get('DATETIME_FORMAT')}"/>
                                </h:outputText>
                            </p:column>
                            <p:column headerText="手机号" style="text-align:center;">
                                <h:outputText value="#{record.phone}"/>
                            </p:column>
                            <p:column headerText="姓名" style="text-align:center;">
                                <h:outputText value="#{record.petname}"/>
                            </p:column>
                            <p:column headerText="金额" style="text-align:center;">
                                <h:outputText value="#{record.amount}"/>
                            </p:column>
                            <p:column headerText="主订单号" style="text-align:center;">
                                <h:outputText value="#{record.parentOrderId}"/>
                            </p:column>
                            <p:column headerText="甲方订单号" style="text-align:center;">
                                <h:outputText value="#{record.partyOrderId}"/>
                            </p:column>
                            <p:column headerText="甲方名称" style="text-align:center;">
                                <h:outputText value="#{record.companyName}" />
                            </p:column>
                            <p:column headerText="类型" style="text-align:center;">
                                <h:outputText value="代扣"  rendered="#{record.type=='WITHHOLD'}"/>
                                <h:outputText value="代付"  rendered="#{record.type=='REMIT'}"/>
                            </p:column>
                            <p:column headerText="业务类型" style="text-align:center;">
                                <h:outputText value="代偿"  rendered="#{record.businessType==0}"/>
                                <h:outputText value="取现"  rendered="#{record.businessType==1}"/>
                            </p:column>
                            <p:column headerText="订单状态" style="text-align:center;">
                                <h:outputText
                                        value="#{compensationChildOrderListBean.translate(DictionaryCode.COMPENSATION_ORDER_STATUS,record.status)}"/>
                            </p:column>
                            <p:column headerText="手续费（元）" style="text-align:center;">
                                <h:outputText value="#{record.fee}"/>
                            </p:column>
                            <p:column headerText="备注" style="text-align:center;">
                                <h:outputText value="#{record.remark}"/>
                            </p:column>
                            <p:column headerText="入口" style="text-align:center;">
                                <h:outputText value="#{record.channelFrom}"/>
                            </p:column>
                            <p:column headerText="卡类型" style="text-align:center;">
                                <h:outputText value="信用卡"  rendered="#{record.cardType==0}"/>
                                <h:outputText value="储蓄卡"  rendered="#{record.cardType==1}"/>
                            </p:column>
                            <p:column headerText="银行卡号" style="text-align:center;width: 150px">
                                <h:outputText value="#{record.cardNum}" />
                            </p:column>
                            <p:column headerText="银行名称" style="text-align:center;">
                                <h:outputText value="#{record.bankName}" />
                            </p:column>
                            <p:column headerText="银行手机号" style="text-align:center;">
                                <h:outputText value="#{record.bankMobileNum}" />
                            </p:column>
                        </p:dataTable>
                    </div>
                </div>
            </div>
        </h:form>
    </ui:define>
</ui:composition>